let obj = {}
while ((str = readline())) {
  const [a, b] = str.split(' ')
  let s = a.substring(a.lastIndexOf('\\') + 1)
  s = s.substring(s.length - 16)
  obj[s + ' ' + b] = (obj[s + ' ' + b] || 0) + 1
}
Object.keys(obj)
  .slice(-8)
  .forEach((item) => {
    console.log(item + ' ' + obj[item])
  })
